local quche = fk.CreateSkill{
    name = "lingling__quche",
}
Fk:loadTranslationTable{
    ["lingling__quche"] = "驱车",
    [":lingling__quche"] = "你计算与其他角色的距离-1。当你使用一张装备牌时，你可以视为使用一张【杀】。当你使用【杀】造成伤害后，你回复1点体力，若你未受伤则改为摸一张牌。",
    ["#lingling__quche"] = "驱车：你可以视为使用一张【杀】",
}

quche:addEffect(fk.CardUsing,{
    anim_type = "offensive",
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(quche.name) and data.card.type == Card.TypeEquip
    end,
    on_cost = function (self, event, target, player, data)
        local use = player.room:askToUseVirtualCard(player,{
          skill_name = quche.name,
          name = "slash",
          skip = true,
          prompt = "#lingling__quche"
        })
        if use then
            event:setCostData(self, use)
            return use
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local use = event:getCostData(self)
        room:useCard(use)
        if use.damageDealt and not player.dead then
            if player:isWounded() then
                room:recover{
                    who = player,
                    num = 1,
                    skillName = quche.name,
                }
            else
                player:drawCards(1, quche.name)
            end
        end
    end,
})

quche:addEffect(fk.CardUseFinished, {
    can_trigger = function (self, event, target, player, data)
        if target == player and player:hasSkill(quche.name) and data.card.trueName == "slash" and data.damageDealt then
            if player:isWounded() then
                event:setCostData(self, {anim_type = "support"})
            else
                event:setCostData(self, {anim_type = "drawcard"})
            end
            return true
        end
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        local room = player.room
        if player:isWounded() then
            room:recover{
                who = player,
                num = 1,
                skillName = quche.name,
            }
        else
            player:drawCards(1, quche.name)
        end
    end,
})

quche:addEffect("distance", {
    correct_func = function(self, from, to)
        if from:hasSkill(quche.name) then
            return -1
        end
    end,
})

return quche